import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/:auth',  // auth=corpid+"###"+gentId,并且使用encodeURIComponent加密(后台组装好，直接拿来用)；corpid 企业微信下的企业id，企业微信下的agentId的自建应用id
      name: 'AppIndex',
      meta:{
        title:'首页'
      },
      redirect: { name: 'Index' }, // 重定向到
      //component: () => import('@/views/index/index.vue')
      children:[
        {
          path: 'index',
          name: 'Index',
          meta:{
            title:'全部客户'
          },
          component: () => import('@/views/index/index.vue')
        },
        {
          path: 'analys',
          name: 'Analys',
          meta:{
            title:'数据统计'
          },
          component: () => import('@/views/analys/index.vue')
        },
        {
          path: 'home',
          name: 'Home',
          meta:{
            title:'我的'
          },
          component: () => import('@/views/home/index.vue')
        },
        {
            path: 'callback',
            name: 'Callback',
            meta:{
              title:'登录中...',
              noAuto:true,
            },
            component: () => import('@/views/callback/index.vue')
        },
        {
            path: 'login',
            name: 'Login',
            meta:{
              title:'登录',
              noAuto:true,
            },
            component: () => import('@/views/login/index.vue')
        },
        {
          path: 'loss',
          name: 'Loss',
          meta:{
            title:'流失的客户'
          },
          component: () => import('@/views/loss/index.vue')
        },
        {
          path: 'mcAnalys',
          name: 'McAnalys',
          meta:{
            title:'成员客户统计'
          },
          component: () => import('@/views/analys/memberCustom/index.vue')
        },
        {
          path: 'moment',
          name: 'Moment',
          meta:{
            title:'客户朋友圈记录'
          },
          component: () => import('@/views/moment/index.vue')
        },
        {
          path: 'groupmsg',
          name: 'Groupmsg',
          meta:{
            title:'群发记录'
          },
          component: () => import('@/views/groupmsg/index.vue')
        },
        {
          path: 'simpleCustom',
          name: 'SimpleCustom',
          meta:{
            title:'我的客户'
          },
          component: () => import('@/views/simpleCustom/index.vue')
        },
        {
          path: 'qrcode',
          name: 'Qrcode',
          meta:{
            title:'制作二维码'
          },
          component: () => import('@/views/home/qrcode/index.vue')
        },
        {
          path: 'custom',
          name: 'Cdetail',
          meta:{
            title:'客户详情'
          },
          component: () => import('@/views/detail/index.vue')
        },
        {
          path: 'remark/set',
          name: 'RemarkSet',
          meta:{
            title:'设置备注和描述'
          },
          component: () => import('@/views/remarkSet/index.vue')
        },
        {
          path: 'meeting',
          name: 'Meeting',
          meta:{
            title:'我的会议'
          },
          component: () => import('@/views/home/meeting/index.vue')
        },
        {
          path: 'meeting/add',
          name: 'MeetingAdd',
          meta:{
            title:'创建会议'
          },
          component: () => import('@/views/home/meeting/add/index.vue')
        },
        {
          path: 'tag/add',
          name: 'TagAdd',
          meta:{
            title:'添加标签'
          },
          component: () => import('@/views/tag/index.vue')
        },
      ]
    }
  ]
})

export default router
